// *************************************************************************************************
//
// MK3D Engine
// --------------------------------------
// Copyright (C) 2007-2011 Zeb (mailto: zebbey@gmail.com)
//
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//
// *************************************************************************************************

#ifndef __H_MK_POST_PROCESSOR_MANAGER__
#define __H_MK_POST_PROCESSOR_MANAGER__

namespace MK3DE
{
	class CPostProcessor;
	class CRenderTarget;

	enum POST_PROCESS_TYPE
	{
		PPT_BLOOM = 0,
		PPT_TWIST,

		PPT_MAX
	};

	class MK3DE_API CPostProcessorManager
	{
	public:
		CPostProcessorManager();
		~CPostProcessorManager();

		//! Create all post processor.
		BOOL Create();

		//! Control whether turn on post process.
		BOOL IsEnable() { return _bEnable; }
		void Enable(BOOL bEnable) { _bEnable = bEnable; }

		//! Get post processor by type.
		CPostProcessor* GetPostProcessor(POST_PROCESS_TYPE type);

		//! Called when render device at lost status.
		void OnDeviceLost();

		//! Begin and end post process frame.
		BOOL BeginFrame();
		BOOL EndFrame();

	private:
		BOOL __CreateRenderTarget(CRenderTarget*& renderTarget);
		void __AppyAllPostProcessor();

	private:
		CPostProcessor* _postProcessorList[PPT_MAX];
		BOOL _bEnable;

		CRenderTarget* _mainRenderTarget;
		CRenderTarget* _swapRenderTarget;
	};
};

#endif // __H_MK_POST_PROCESSOR_MANAGER__